import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  // 自增
  CreateDateColumn,
} from 'typeorm';
import {
  ColumnStatus,
  YixiantongFieldItem,
  YixiantongCities
} from './yixiantong.type';

@Entity()
export class YixianTongFields {
  @PrimaryGeneratedColumn({
    type: 'bigint',
    name: 'id',
    comment: '主键id',
  })
  public id: number;

  @Column({
    comment: '名称简称',
    nullable: false, // 非空
    unique: true, // 唯一
  })
  public name: string;

  @Column({
    comment: '名称全称（别名）',
    name: 'alias_name',
  })
  public aliasName: string;

  @Column({
    comment: '简介',
    type: 'text',
    name: 'description',
  })
  public description: string;

  @Column({
    comment: '图片',
    type: 'longtext',
  })
  public img: string;

  @CreateDateColumn({
    comment: '创建时间',
    name: 'create_time',
    type: 'datetime',
    nullable: false, // 非空
    default: null // 设置默认值为当前时间戳
  })
  public createTime: Date;

  @CreateDateColumn({
    comment: '更新时间',
    name: 'update_time',
    type: 'datetime',
    nullable: false, // 非空
    default: null // 设置默认值为当前时间戳
  })
  public updateTime: Date;

  @Column({
    comment: '状态',
    default: ColumnStatus.Normal,
  })
  public status: ColumnStatus;
}
